biased_price_targetLibrary "biased_price_target"
Collection of functions that can be used for the calculation of biased price targets like stop loss and
take profit from a reference price using several methods that are already provided by the "distance_ratio" library plus
the 'HHLL'. Methods supported are percentagewise (PERC), atr-based (ATR), fixed profit (PROF), tick-based (TICKS),
risk reward ratio (RR), and highest high/lowest low (HHLL)
[i]price
Manual PnL (Profit and Loss) % Tracker - spot long only
This is a manual profit and loss tracker. It takes the user's manual input of total cost and quantity, and then outputs a table on the bottom right of the chart showing the profit or loss %, average purchase price, gross profit or loss, and market value.
Instructions:
1. Double click the indicator title at the top left of the chart
2. Select the "Inputs" tab and click the empty field next to "Symbol" to enter the traded symbol+exchange. This entry MUST be the same as the chart you are on, for example BTCUSDT/BINANCE (indicator will not display otherwise)
3. Enter the Total Cost and Qty of shares/coins owned
4. Optional - change positive or negative colors
5. Optional - under the "Style" tab, change the color of the average price (AVG) line
Note that for the average price (AVG) line to be shown/hidden you must enable/disable "Indicator and financials labels" in the scales settings.
For crypto or other tickers that have prices in many decimal places I would suggest, for the sake of accuracy, adjusting the decimal places in the code so that for prices under $1 you will display more info.
For example let's say you purchase x number of crypto at a price of 0.031558 you should change the code displaying "0.00" on line 44 to "0.000000"
This will ensure that the output table and plotted line will calculate an average price with the same number of decimals.
CurrentlyPositionIndicatorLibrary "CurrentlyPositionIndicator"
Currently position indicator
run(_index, _price, _stoploss, _high, _low, _side, _is_entered, _colors, _position_left, _box_width)
Currently positions indicator
Parameters:
_index (int) : entry index
_price (float) : entry price
_stoploss (float) : stoploss price
_high (float) : range high
_low (float) : range low
_side (int)
_is_entered (bool) : is entered
_colors (color ) : color array
_position_left (int) : Left position
_box_width (int) : box's width
Returns: TODO: add what function returns
Advanced Price Direction AlgorithmPrices can go up or down or falter in their movement.
This code evaluates this by looking at two consecutive bars or sets of bars.
If you put the set size to 1, the current and previous bar is evaluated.
If put to 2, the last2 and the 2 before these are evaluated.
Default is 12 because this seems to coincide with trend changes.
This code provides an advanced way to evaluate what the price does in a sort of three-value Boolean with the values up, down or falter.
I use this code in indicators I develop where price direction is taken into account.
The simple output makes it possible to use it as an indicator on its own.
Price & Percentage Change LabelFairly straightforward script that allows you to plot the current price and % either above the last candle and/or to the right of it. There's also 2 price "follow" lines that you can turn off and on, much like the bid/ask line that's built in to TV.
You can also choose to enable a specific % above/below current price to give you an idea on where price would be with a move north or south by X % amount from current price.
Prior day and pre-market high lowThis indicator displays the:
- Prior day high
- Prior day low
- Pre-market high
- Pre-market low
as a coloured line across the entire session for each individual session on an intraday chart.
For the extended session, this indicator marks the prior day and pre-market high low for each individual session starting at the pre-market and ending in the post-market, a feature not available on other indicators.
This indicator automatically marks out the levels for the prior day and pre-market high low for each individual session, allowing the user to observe how the price action behaves around the prior day and pre-market high low.
Note:
In this script, request.security() used with lookahead = barmerge.lookahead_on to fetch prices without offsetting the series by for the extended session does not access future data. This is because for extended session, request.security() sees the start of the session to be at the start of the regular session and ends at the end of the pre-market, when in reality the session starts at the start of the pre-market and ends at the end of the post-market.
Hence in each extended session when the line is first drawn in the pre-market, request.security() returns the value of the prior day high/low, and not future data.
occ3aka weighted fair price
The ultimate price source for all your stuff, unless you go completely nuts.
The ultimate way to build line charts & do pattern trading, unless you go completely nuts.
Why occ3?
You need a one-point estimate for every bar, a typical price of every bar aye? But then you see that every bar has a different distribution of prices. You can drop a stat test on every bar and pick median, mean, or whatever. But that's still prone to error (imagine borderline cases).
Instead, you can transform the task into a geometric one and say, "I wanna find the center of mass of all dem ticks within a particular interval (a day, a week, a century)". But lol ofc you won't do it, so lets's estimate it:
1) a straight line from Open to Close more/less estimates a regression line if you woulda dropped regression on all the ticks within a given interval;
2) centroid always lies on regression line, so it's always in between the endpoints of regression line. So that's why (open + close) /2;
3) Then, you remember that sequence matters, + generally the volume is higher near the close, so...;
4) Voila, (open + close + close) / 3
Why "fair" price?
Take a daily bar:
1) High & low were the best prices to sell & buy;
2) Opening & closing auctions had acceptable prices, in exchange for the the biggest potential to transact serious volume;
3) "Fair" price, logically, is somewhere in between the acceptable prices;
4) Market is fractal => the same principles propagate everywhere;
4) No, POCs and VPOCs don't make much sense as fair prices.
Nothing else to say, really advise to use it as a line chart if you trade price patterns.
Power Indicator - EMAs + VWAP + Volume BarThe Power Indicator is intended to return some exponential moving average, vwap, volume bar, and others. With this compilation, you will be able to use them as one indicator in Trading View.
The components are:
- EMA9 - Exponential Moving Average of 9 days
- EMA21 - Exponential Moving Average of 21 days
- EMA50 - Exponential Moving Average of 50 days
- EMA200 - Exponential Moving Average of 200 days
- Volume Bar - This indicator provides the volume of the candle and its strength by showing different colors. It's a way to check expressive volume in one bar.
- Vwap line
- Indicator
If you have any questions, let me know!
BTC Pair Change %This script makes it easier to quickly check how the BTC pair of the current symbol is performing on any pair.
It adds a " change percentage widge t" (of the BTC pair ) to the top right of the chart.
(Refer to the image for an example.)
The change percentage calculation is performed as described here:
www.tradingview.com
To match the "Chg%" that appears on TradingView watchlists, a 24H (1440min) timeframe is used, as described here:
money.stackexchange.com
In short, this script:
Searches for the BTC pair of the current symbol
Calculates the change % using the above described logic (links)
Adds a " change percentage widget " (of the BTC pair) to the top right of the chart
Allows for using 24H timeframe or the current timeframe (enable " Use current timeframe " under the script options)
Chart Time and Price Range It is easy to loose track of time and price volatility when the chart automatically scales to the bars on the chart. This helps you keep track.
This is a very simple indicator that is designed to ensure that you're looking at a segment of the chart that is relevant to the trade you're considering in both price distance and time.
The Problem:
When looking at a chart the lowest price is at the bottom of the screen, the highest price is at the top. The time at the beginning of the chart is based on how many bars and what timeframe you're looking at.
But is the price difference between the two wide or narrow? Are you seeing minutes, hours, or days of price action?
You can get the measure tool out, but you'll change the zoom level and now its different. You change the timeframe and its different.
This Solution:
This indicator puts a table on the screen that will tell you the X/Y distance of everything that is on your chart. If your hold period is 5 minutes, why would you be looking at 3 days of price action to find s/r or make a decision on a trade?
This will show you how much price opportunity was available in the amount of time you are currently viewing. Using the PineCoders VisibleChart library, we're retrieving the time and bar_index of the beginning of the chart so that everything that is currently on the chart is measured and it adapts as that changes.
It will work with light and dark themes (you can change the colors) and can be positioned wherever you prefer to see the information.
Disclaimer: This was a quick release script. I wrote it and published the same day. There could be bugs, so send me a message or add a comment to report anything that isn't behaving correctly.
The Price of Hard MoneyIf we calculate “the price of hard money” (the market capitalization weighted price of gold plus Bitcoin); we get this chart.
Since 2017, Bitcoin’s share of hard money growth has been increasing, we can see it visibly on the gold chart by a widening delta between the price of hard money and the Gold price. We can also see some interesting technical behaviours.
In 2021, Hard Money broke out and held this breakout above the 2011 Gold high. Only later in 2022 did a correction of 20% occur – typical of Golds historic volatility in periods of inflation and high interest rates.
Hard Money is at major support and we have evidence for a fundamental shift in investor capital flows away from gold and into Bitcoin.
This Indicator is useful:
- To track the market capitalization of Gold (estimated), Bitcoin and combined market capitalization of Hard Money.
- To track the price action and respective change in investor flows from Gold to Bitcoin .
Provided Bitcoin continues to suck more value out of gold with time, this chart will be useful for tracking price action of the combined asset classes into the years to come.
Anchored VWAP BandSimple script to anchor vwap to a drag and drop spot on the chart and display it as a band instead of a line.
the AVAP Band displays:
1. The AVWAP using High as the source
2. The AVWAP using OHLC4 as the source
3. The AVWAP using Low as the source
This is just a different way of visualising VWAP from an anchored point in time (Band vs Line)
ABC_caluculator for Ichimoku Kinko Hyo(IKH) usersThis tool is using for calculating Target Value(N,V,E prices) by only clicking on a chart.
There is several points which makes it better.
Decrease the number of times of clicking.
Calculator needs a reset button, it's like loop structure. Push the reset and function again.
Plot percentages which it compare closing price and Target Value(N,V,E prices) on a chart.
Plot loss cut points from evaluating risk/returns.
My question is also written down precisely here !!!!!
↓
stackoverflow.com
LowHighFinderThis chart display how value change of (low,high,close,open) is considered as a factor for buying or selling. Each element take same weight when consider the final price. The price change over a certain threshold would be the decision point (buy/sell)
Factors considered in this chart
1.Quotes: High,low,close,open,volume. If one of them higher than previous day, then it increase, otherwise decreases.
2. Multipler: If you think one quote is more important than other (High more important than close, you can set multipler higher)
3. EMA smoother: It is using to balance the price effect. Like if price increased dramatically, EMA would notify whether could be a good time to sell. (Because high deviation between MA and price suggest price increase too fast)
4. Length of line: set length of line for you need
5. Percentage change: how much percentage change is considered a significant change? 5%? or 10%? In which case should it count toward the final indicator? Adjust percentage change needed, smaller for minutes chart (less than 10) higher for hours chart (10-20), even higher for day chart
Buy/Sell method:
1. When green dot appears, wait after price start to get close to moving average to find the low point and buy.
2. Reverse for red dot.
Real Price Line + Dots (for Heikin Ashi)Real Price Line + Dots (for Heikin Ashi)
This indicator is designed for use on Heikin Ashi charts. Its purpose is to enable traders to benefit from price averaging and smoothing effects of Heikin Ashi candles whilst also enabling them to see the current real price line, and optionally, real price close dots on the Heikin Ashi candlesticks.
Features include:
- Optional real price line
- Optional real price close dots
- Customisable colours
- Customisable line style
- Customisable line width
What are Heikin Ashi candles?
Heikin Ashi means 'average bar' in Japanese, Heikin Ashi charts do not show real price as standard, due to the way the Open, High, Low and Close values are calculated using averages, This is done in order to create a smoother appearance and reduce the market 'noise'.
You can read more about Heikin Ashi candlesticks here.
NOTE:
- If real price dots appear behind the candles, you may need to select the triple dot menu on the indicator then select "Visual order" > "Bring to front" , so that the dots are shown above the candles.
- When using this indicator on a Heikin Ashi chart, the standard Tradingview price line will not show accurate real price. Therefore when using the price line in this indicator, the standard price line should be disabled within the Tradingview 'Chart settings' dialog > 'Symbol' tab > uncheck 'Last', under the 'Price line' section.
Rule Of 20 - Fair Value Estimation by Inflation & Earnings (TG)The Rule Of 20 is a heuristic calculation to find the fair value of an asset or market given its earnings and current inflation.
Its calculation is straightforward: the fair multiple of the price or price-to-earnings ratio of a stock should be 20 minus the rate of inflation.
In math terms: fair_price-to-earnings_ratio = (20 - inflation) ; fair_value = current_price * fair_price-to-earnings_ratio / real_price-to-earnings_ratio
For example, if a stock or index was trading on 11 times earnings and inflation was 2%, then the theory would be that the fair price-to-earnings ratio would be 20-2 = 18, which is much higher than the real price-to-earnings ratio of 11, and hence the asset would be undervalued.
Conversely, a market or company that was trading on 18 times price-to-earnings ration when inflation was 8% was seen as overvalued, because of the fair price-to-earnings ratio being 20-8=12, hence much lower than the real price-to-earnings ratio of 18.
We can then project the delta between the fair PE and real PE onto the asset's value to obtain the projected fair value, which may be a target of future value the asset may reach or hover around.
For example, as of 1st November 2022, SPX stood at 3871.97, with a PE ratio of 20.14 and an inflation in the US of 7.70. Using the Rule Of 20, we find that the fair PE ratio is 20-7.7=12.3, which is much lower than the current PE ratio of 20.14 by 39%! This may indicate a future possibility of a further downside risk by 39% from current valuation levels.
The origins of this rule are unknown, although the legendary US fund manager Peter Lynch is said to have been an active proponent when he was directing the Fidelity’s Magellan fund from 1977 to 1990.
For more infos about the Rule Of 20, reading this article is recommended: www.sharesmagazine.co.uk
This indicator implements the Rule Of 20 on any asset where the Financials are availble to TradingView, and also for the entire SP:SPX index as a way to assess the wider US stock market. Technically, the calculation is a bit different for the latter, as we cannot access earnings of SPX through Financials on TradingView, so we access it using the QUANDL:MULTPL/SP500_PE_RATIO_MONTH ticker instead.
By default are displayed:
current asset value in red
fair asset value according to the Rule Of 20 in white for SPX, or different shades of purple/maroon for other assets. Note that for SPX there is only one calculation, whereas for other assets there are multiple different ways to calculate earnings, so different fair values can be computed.
fair price-to-earnings ratio (PE ratio) in light grey.
real price-to-earnings ratio in darker grey.
This indicator can be used on SP:SPX ticker, and on most NASDAQ:* tickers, since they have Financials integrated in TradingView. Stocks tickers from other exchanges may not provide Financials data, so this indicator won't work then. If this happens, try to find the same ticker on NASDAQ instead.
Note that by default, only the US stock market is considered. If you want to consider stocks or assets in other regions of the world, please change the inflation ticker to a ticker that reflect the target region's inflation.
Also adding a table to ease interpretation was considered, but then the Timeframe MTF parameter would not work, and since the big advantage of this indicator is to allow for historical comparisons, the table was dropped.
Enjoy, and keep in mind that all models are wrong, but some are useful.
Trade safely!
TG
Extension %This is a tracking tool to measure two different kinds of distances:
- Gaps, from the open/close or the high/low value to the nearest open/close or high/low value.
- Price extensions of one or two candles from a preferred starting point (open, high, low or close) to a final point (open, high, low or close). The two-candles mode includes an optional rectangle to help you visualize the first and the last point of the measurement.
The script will plot a label with a percentage when the extension reaches the value you set. Unless you choose to track the one-candle price extension, the label will always be displayed on the high/low value of the second candle.
[FFriZz]Priceline/TicksFFriZz | FrizLabz -- Priceline/Ticks
Due to TradingView not allowing us to change the size or style of the Priceline I decided to make this
You can change the style, size, color of the Price line with this Script
There is also an option for the closing price to be plotted on the Priceline
-- Colors --
You can have the Line and/or the Closing price change colors with the price movements
both are adjustable to your preference
-- Ticks --
Will show the difference in price from tick to tick
when Volume moves but price doesn't it will show '▲▼'
-- Adjustments --
The offset of the Close and Ticks can be adjusted from left to right
Can Extend Priceline in all directions
Can change the Line style and Width
Can change all the Text sizes and Colors
Can also Change Colors to change with Price movements
Can Change number of Ticks to show
-- Priceline --
You don't have to but I suggest going to the settings of your Chart and turning off the Priceline
-- Challenge --
There is Some code at the bottom that will move the Label and Ticks to the x% of your screen in from the right once
the last bar is no longer visible. I decided not to use it because even when the feature is turned off any movement of the
chart resets the Ticks. If you find out a way to have it not reset the Ticks Let me know!
If you find any bugs or have any suggestions feel free to DM me or leave a comment!
Hope you Enjoy! -- FFriZz | FrizLabz
Price LevelsAuto plots significant Gann and Fib price levels using the all time range. Useful to quickly identify significant levels of support and resistance.
KERPD Noise Filter - Kaufman Efficiency Ratio and Price DensityThis indicator combines Kaufman Efficiency Ratio (KER) and Price Density theories to create a unique market noise filter that is 'right on time' compared to using KER or Price Density alone. All data is normalized and merged into a single output. Additionally, this indicator provides the ability to consider background noise and background noise buoyancy to allow dynamic observation of noise level and asset specific calibration of the indicator (if desired).
The basic theory surrounding usage is that: higher values = lower noise, while lower values = higher noise in market.
Notes: NON-DIRECTIONAL Kaufman Efficiency Ratio used. Threshold period of 30 to 40 applies to Kaufman Efficiency Ratio systems if standard length of 20 is applied; maintained despite incorporation of Price Density normalized data.
TRADING USES:
-Trend strategies, mean reversion/reversal/contrarian strategies, and identification/avoidance of ranging market conditions.
-Trend strategy where KERPD is above a certain value; generally a trend is forming/continuing as noise levels fall in the market.
-Mean reversion/reversal/contrarian strategies when KERPD exits a trending condition and falls below a certain value (additional signal confluence confirming for a strong reversal in price required); generally a reversal is forming as noise levels increase in the market.
-A filter to screen out ranging/choppy conditions where breakouts are frequently fake-outs and or price fails to move significantly; noise level is high, in addition to the background buoyancy level.
-In an adaptive trading systems to assist in determining whether to apply a trend following algorithm or a mean reversion algorithm.
THEORY / THOUGHT SPACE:
The market is a jungle. When apex predators are present it often goes quiet (institutions moving price), when absent the jungle is loud.
There is always background noise that scales with the anticipation of the silence, which has features of buoyancy that act to calibrate the beginning of the silence and return to background noise conditions.
Trend traders hunt in low noise conditions. Reversion traders hunt in the onset of low noise into static conditions. Ranges can be avoided during high noise and buoyant background noise conditions.
Distance between the noise line and background noise can help inform decision making.
CALIBRATION:
- Set the Noise Threshold % color change line so that the color cut off is where your trend/reversion should begin.
- Set the Background Noise Buoyancy Calibration Decimal % to match the beginning/end of the color change Noise Threshold % line. Match the Background Noise Baseline Decimal %' to the number set for buoyancy.
- Additionally, create your own custom settings; 33/34 and 50 length also provides interesting results.
- A color change tape option can be enabled by un-commenting the lines at the bottom of this script.
Market Usage:
Stock, Crypto, Forex, and Others
Excellent for: NDQ, J225, US30, SPX
Market Conditions:
Trend, Reversal, Ranging
Price ProfileThe indicator shows number of candles present in the horizontal box areas for the given time window. You can set up:
1) Start time
2) Stop time
3) Number of horizontal bars
Previous Days RangesPrevious Days Ranges
Simply plots out market ranges of previous days price action, of which are the following:
Previous Day High
Previous Day Low
Previous Day Extended High
Previous Day Extended Low
Supports adjustments of timeframes, for different time zones, and style.
Multi Price AlertSometimes you need set some alert at specific price levels on a chart.
Now you able to set ten different price levels to get alert at this prices.
With this Indicator also Basic Accounts can set more than one alert at price levels.
How to Use :
1- Enable Indicator on your Chart
2- Input your prices on Indicator Settings
3- Active Indicator Alert on 1m Chart (Select Multi Price Alert on Conditions Menu & Once Per Bar on Options)
5- Enjoy !
Notice : If change at prices, you should remove and reset Alert again.
Good trading to all ...